export default {
  namespaced: true,
  state: {
    programData: []
  },
  getters: {
    programData: state => {
      return state.programData;
    }
  },
  mutations: {
    //添加/更新数据数据
    addProgramData(state, data) {
      let index = state.programData.findIndex(item => item.key == data.key);
      if(index == -1){
        state.programData.push(data);
      } else{
        state.programData.splice(index,1,data);
      }
    },
    //删除数据
    delProgramData(state,key){
      let index = state.programData.findIndex((item) => item.key == key);
      state.programData.splice(index,1);
    },
    //清空数据
    clearProgramData(state){
      state.programData = [];
    },
   
  }
};
